﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DataInput
{
    public class NumericField : TextField
    {
        public NumericField() : base ()
        {
        }

        public override bool isValid()
        {
            if (base.isValid())
            {
                String value = (String)this.Value;
                for (int i = 0; i < value.Length; i++)
                    if (!Char.IsDigit(value[i]))
                        return false;
                return true;
            }
            else
                return false;
        }

        public NumericField(String fieldName, String fieldLabel, bool canBeEmpty) : this (fieldName, fieldLabel, canBeEmpty, false )
        {
        }
        public NumericField(String fieldName, String fieldLabel, bool canBeEmpty, bool forOutput )
            : base(fieldName, fieldLabel, canBeEmpty, forOutput)
        {
        }

        public NumericField(String fieldName, String fieldLabel, Object value, bool canBeEmpty)
            : this(fieldName, fieldLabel, value, canBeEmpty, false) 
        {
        }

        public NumericField(String fieldName, String fieldLabel, Object value, bool canBeEmpty, bool forOutput)
            : base(fieldName, fieldLabel, value, canBeEmpty, forOutput )
        {
        }
    }
}
